package com.alibaba.nacos.config.server.jpa.repository;

import java.util.List;

import com.alibaba.nacos.config.server.jpa.entity.TenantInfoEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;

/**
 * @author
 * @date 2020-03-08 23:31
 */
@Repository
public interface TenantInfoRepository extends BaseRepository<TenantInfoEntity, Long> {

    int countByTenantId(String tenantId);

    List<TenantInfoEntity> findAllByKp(String kp);

    TenantInfoEntity findByKpAndTenantId(String kp, String tenantId);

    TenantInfoEntity findByTenantIdAndKp(String tenantId, String kp);

    @Modifying
    void deleteByKpAndTenantId(String kp, String tenantId);

}
